package com.cloud.phone.broadcastReceiver

import android.app.admin.DeviceAdminReceiver
import android.content.Context
import android.content.Intent
import android.provider.Settings

/**
 * @auth: njb
 * @date: 2024/6/5 10:03
 * @desc: 描述
 */
class MyDeviceAdminReceiver:DeviceAdminReceiver() {
    override fun onEnabled(context: Context, intent: Intent) {
        super.onEnabled(context, intent)
        if (!Settings.canDrawOverlays(context)) {
            val overlayIntent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION)
            overlayIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            context.startActivity(overlayIntent)
        }
    }
}